package com.jianying.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.jianying.shared.Utils;

public class Purchase {
	
	public static enum State {
		gived,// '下单',
	    accepted,// '已接单',
	    holding,// '处理中',
	    holded,// '处理完毕',
	    partially,// '部分交货',
	    finished,// '交货完成',
	    untrod,//'向供应商退货'
	}
	
	private Integer id;
	
	private String uuid;
	
	private String serialNo;
	
	private State workflowState;
	
	private Boolean hurry;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date handOverAt;
	
	private Double price;
	
	private Integer supplierId;
	
	private String supplierName;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date giveAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date acceptAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date handleAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date handledAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date retrieveAt;
	
	private Date untreadAt;
	
	private String untreadReason;

	private Integer settlementId;
	
	private Integer forwardId;
	
	private Integer deliveryId;
	
	private String productNo;
	
	private String color;
	
	private String size;
	
	private String images;
	
	private Integer categoryId;
	
	private String categoryName;
	
	private Integer quantity;
	
	private String unit;
	
	private String productNote;
	
	private Integer tenantId;
	
	private Integer receivedQuantity;
	
	private Integer unReceivedQuantity;
	
	private String specJson;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date createAt;
	
	private Integer orderId;
	
	@JsonProperty
	public String firstImage() {
		return Utils.firstImage(images);
	}
	
	@JsonProperty
	public List<String> imageArray() {
		return Utils.imageArray(images);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	public State getWorkflowState() {
		return workflowState;
	}

	public void setWorkflowState(State workflowState) {
		this.workflowState = workflowState;
	}

	public Boolean getHurry() {
		return hurry;
	}

	public void setHurry(Boolean hurry) {
		this.hurry = hurry;
	}

	public Date getHandOverAt() {
		return handOverAt;
	}

	public void setHandOverAt(Date handOverAt) {
		this.handOverAt = handOverAt;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Integer getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(Integer supplierId) {
		this.supplierId = supplierId;
	}

	public String getSupplierName() {
		return supplierName;
	}

	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}

	public Date getGiveAt() {
		return giveAt;
	}

	public void setGiveAt(Date giveAt) {
		this.giveAt = giveAt;
	}

	public Date getAcceptAt() {
		return acceptAt;
	}

	public void setAcceptAt(Date acceptAt) {
		this.acceptAt = acceptAt;
	}

	public Date getHandleAt() {
		return handleAt;
	}

	public void setHandleAt(Date handleAt) {
		this.handleAt = handleAt;
	}

	public Date getHandledAt() {
		return handledAt;
	}

	public void setHandledAt(Date handledAt) {
		this.handledAt = handledAt;
	}

	public Date getRetrieveAt() {
		return retrieveAt;
	}

	public void setRetrieveAt(Date retrieveAt) {
		this.retrieveAt = retrieveAt;
	}

	public Date getUntreadAt() {
		return untreadAt;
	}

	public void setUntreadAt(Date untreadAt) {
		this.untreadAt = untreadAt;
	}

	public String getUntreadReason() {
		return untreadReason;
	}

	public void setUntreadReason(String untreadReason) {
		this.untreadReason = untreadReason;
	}

	public Integer getSettlementId() {
		return settlementId;
	}

	public void setSettlementId(Integer settlementId) {
		this.settlementId = settlementId;
	}

	public Integer getForwardId() {
		return forwardId;
	}

	public void setForwardId(Integer forwardId) {
		this.forwardId = forwardId;
	}

	public Integer getDeliveryId() {
		return deliveryId;
	}

	public void setDeliveryId(Integer deliveryId) {
		this.deliveryId = deliveryId;
	}

	public String getProductNo() {
		return productNo;
	}

	public void setProductNo(String productNo) {
		this.productNo = productNo;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public String getImages() {
		return images;
	}

	public void setImages(String images) {
		this.images = images;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getProductNote() {
		return productNote;
	}

	public void setProductNote(String productNote) {
		this.productNote = productNote;
	}

	public Date getCreateAt() {
		return createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}

	public Integer getTenantId() {
		return tenantId;
	}

	public void setTenantId(Integer tenantId) {
		this.tenantId = tenantId;
	}

	public Integer getReceivedQuantity() {
		return receivedQuantity;
	}

	public void setReceivedQuantity(Integer receivedQuantity) {
		this.receivedQuantity = receivedQuantity;
	}

	public Integer getUnReceivedQuantity() {
		return unReceivedQuantity;
	}

	public void setUnReceivedQuantity(Integer unReceivedQuantity) {
		this.unReceivedQuantity = unReceivedQuantity;
	}

	public String getSpecJson() {
		return specJson;
	}

	public void setSpecJson(String specJson) {
		this.specJson = specJson;
	}

	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}
	
}
